package GUI;

import Client.BusinessImplements;
import Client.ServerProxy;
import Controler.*;
import DAL.*;

import java.awt.EventQueue;
import java.awt.PopupMenu;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;


public class Frame_Win extends JFrame {

	private static final long serialVersionUID = 1L;
	private Log_in_panel lg;
	
	private Sign_in_panel sip;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Frame_Win frame = new Frame_Win();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Frame_Win() {
		
		super();
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent arg0) {
			ServerProxy sp=	BusinessImplements.GetInstance().getServerProxy();
			if(sp!=null)
				sp.close();
				
			}
		});
		lg=new Log_in_panel();
		
		sip=new Sign_in_panel();
		
		initialize();
		BusinessImplements.GetInstance().setMainFrame(this);
	
	}

	
	private void initialize() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 499, 337);
		setContentPane(lg);
		lg.on_screen_load();
	}
	
	
	public void displayMenu()
	{
		
		setContentPane(sip);
		sip.setSize(getMaximumSize());
		sip.on_screen_load();
	}


	public void set_max_size()

	{
		Toolkit tk = Toolkit.getDefaultToolkit();
		int xSize = ((int) tk.getScreenSize().getWidth());
		int ySize = ((int) tk.getScreenSize().getHeight());
		this.setBounds(0, 0, xSize, ySize);
	}
	

	
}



